using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class BeginPanel : MonoBehaviour
{
    public Rect titlePos;
    public GUIContent titleContent;
    public GUIStyle titleStyle;
    public Rect startButtonPos;
    public  GUIContent startButtonContent;
    public Rect settingButtonPos;
    public GUIContent settingButtonContent;
    public Rect exitButtonPos;
    public GUIContent exitButtonContent;
    public GUIStyle buttonStyle;

    
    private static BeginPanel _instance;

    public static void ShowMe()
    {
        if (_instance != null)
        {
            _instance.gameObject.SetActive(true);
        }
    }

    public static void HideMe()
    {
        if (_instance != null)
        {
            _instance.gameObject.SetActive(false);
        }
    }
    
    private void OnGUI()
    {
        GUI.Label(titlePos, titleContent, titleStyle); // 标题
        if (GUI.Button(startButtonPos, startButtonContent, buttonStyle))
        {
            SceneManager.LoadScene("Game"); // 切换场景
        } // 开始

        if (GUI.Button(settingButtonPos, settingButtonContent, buttonStyle))
        {
            SceneManager.LoadScene("Setting");
        } // 设置
        if (GUI.Button(exitButtonPos, exitButtonContent, buttonStyle))
        {
            Application.Quit();
        } // 退出
        
    }
}
